fix(deploy): inject DOCKER_BUILD_ARGS into the Dockerfile#118
Conversation
|
@bacongobbler Won't this cause a rebuild of the docker image every time a new environment var is set on the app? Or is docker smart enough about that? |
|
If a Dockerfile defines an ARG variable whose value is different from a previous build, then a “cache miss” occurs upon its first usage, not its definition. Since it's appended to the end of the Dockerfile then this won't cause cache misses. |
|
@bacongobbler may need a minor formatting change to add a newline between multiple args: |
|
Thanks for testing this! I even ensured that we write to a new line as well to ensure we're not clashing with existing dockerfiles. |
|
Testing looks good; happy path spec around this added in deis/workflow-e2e#349 (didn't appear we previously had a spec that covered config:set on dockerfile app). The e2e run on that pr will run with this change as well. |
| # ensure we are on a new line | ||
| dockerfile.write("\n") | ||
| for envvar in buildargs: | ||
| dockerfile.write("ARG {}\n".format(envvar)) |
There was a problem hiding this comment.
I think the with block can be limited to float(client.version()['ApiVersion']) < 1.13 because the error was changed to a warning in moby/moby#26249 which is part of the 1.13.0 milestone (unless you also want to suppress the warning).
this should close deis/builder#490.